#ifndef _Manage_Club_DB_H_
#define _Manage_Club_DB_H_

#include "DBAgentServant.h"
#include "ClubProto.h"

using namespace std;
using namespace dbagent;

// 检查俱乐部名字唯一性
tars::Int32 ManageClubCheckNameExist(const DBAgentServantPrx prx, string sClubName);

// 检查俱乐部ID唯一性
tars::Int32 ManageClubCheckIdExist(const DBAgentServantPrx prx, tars::Int64 cId);

// 生成俱乐部ID
tars::Int32 ManageClubGetID(const DBAgentServantPrx prx, tars::Int64 &cId);

// 生成俱乐部
tars::Int32 ManageClubCreate(const DBAgentServantPrx prx, tars::Int64 uId, tars::Int64 cId, std::string name, std::string country);

// 更新俱乐部信息
tars::Int32 ManageClubModify(const DBAgentServantPrx prx, tars::Int64 cId, int flag, int status, std::string country, std::string logo, std::string name, std::string notice, int show, int tableLimit, int level, int levelDay, tars::Int64 uId);

// 生成成员
tars::Int32 ManageClubCreateMember(const DBAgentServantPrx prx, tars::Int64 uid, tars::Int64 cId, tars::Int32 position);

// 删除俱乐部成员
tars::Int32 ManageClubDeleteMember(const DBAgentServantPrx prx, tars::Int64 uId, tars::Int64 cId);

// 获取俱乐部
tars::Int32 ManageClubGetClub(const DBAgentServantPrx prx, Club::ClubDBInfo &info, tars::Int64 cId);

// 获取俱乐部成员
tars::Int32 ManageClubGetMember(const DBAgentServantPrx prx, Club::ClubDBMember &info, tars::Int64 uId, tars::Int64 cId);

// 检查创建俱乐部数量
tars::Int32 ManageClubGetCreatedCount(const DBAgentServantPrx prx, tars::Int64 uId, int &count);

// 获取创建加入的俱乐部ID与职位
tars::Int32 ManageClubGetClubIDAndPosition(const DBAgentServantPrx prx, tars::Int64 uId, std::map<long, int> &mClubIds);

// 获取俱乐成员UID
tars::Int32 ManageClubGetMemberID(const DBAgentServantPrx prx, tars::Int64 cId, std::vector<long> &vUid);

// 检查个人俱乐部权限
tars::Int32 ManageClubCheckPosition(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 uId, tars::Int32 position);

// 获取个人俱乐部职位
tars::Int32 ManageClubGetOwnPosition(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 uId, int &position);

// 申请信息表俱乐部与联盟共用一表org
// 获取申请信息数量
tars::Int32 ManageClubGetApplyCount(const DBAgentServantPrx prx, tars::Int64 cId, long &count);

// 获取俱乐部单个申请详情
tars::Int32 ManageClubGetApply(const DBAgentServantPrx prx, Club::ClubApplyInfo &info, tars::Int64 id);

// 创建俱乐部申请信息
tars::Int32 ManageClubInsertApply(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 tId, tars::Int64 uId, tars::Int32 status, string msg);

// 检测俱乐部申请信息
bool ManageClubCheckApply(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 tId, tars::Int64 uId);

// 更新俱乐部申请信息
tars::Int32 ManageClubUpdateApply(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 tId, tars::Int64 uId, string msg);

// 修改俱乐部申请信息
tars::Int32 ManageClubModifyApply(const DBAgentServantPrx prx, tars::Int64 id, tars::Int64 uId, tars::Int32 status);

// 更新俱乐部保险保证金
tars::Int32 ModifyClubFund(const DBAgentServantPrx prx, tars::Int64 cId, bool isAdd, int level, long fund);

// 更新俱乐部商户等级
tars::Int32 ModifyClubMerchantLevel(const DBAgentServantPrx prx, tars::Int64 cId, int level);

#endif